Template Strings
Introduction
Template strings allow you to mix static text with dynamic values coming from components, Clipboards or SourceLinks.
Combined with OData operators, you can also build powerful, data-driven filters for tables and other components.
This page explains:
- how template strings are structured
- how to insert values like
{value}safely - how to use OData operators such as
eq,lt,contains - how to combine both concepts in yeet
Template Strings Basics
A template string is a normal text property that contains placeholders.
When the application runs, these placeholders are replaced with actual values.
Common usage areas:
- labels in yLabel
- helper texts and messages
- dynamic OData filter expressions in tables
- text modules filled with SourceLink data
Placeholders
Placeholders are written inside curly braces. In the docs we show them as inline code:
- Simple value:
{value} - Named value:
{firstName} - Clipboard property:
{clipboard.customerName}
In your property values, you would write for example:
Hello {firstName}, welcome to yeet!
Whenever you show placeholders in the documentation, wrap them in backticks like
{value} instead of writing them raw.
Template Strings with SourceLinks
Template strings become really useful when combined with SourceLinks.
Typical flows:
- A component raises a SourceLink event.
- Another component (e.g. a label or table filter) listens to that event.
- The event payload is injected into the template string and replaces placeholders.
Example: Label text from an input
Imagine a yInput and a yLabel. You want the label to show the current input value:
Current value: {value}
Steps:
- Connect the yInput to the yLabel via SourceLink (for example: valueChanged → label).
- Set the label property of yLabel to:
Current value: {value} - When the input changes, the label updates automatically.
Combining Template Strings with OData
The real power comes from mixing template placeholders with OData operators in a single string.
Example: Filter by a selected customer
Suppose you have:
You can define a template string for the table’s filter:
CustomerId eq {customerId}
At runtime, {customerId} is replaced by the actual value from the Clipboard.
So if customerId = 42, the effective filter will be:
CustomerId eq 42
Example: Filter by text input
If you want a filter that searches by a user-entered term:
contains(Name, '{searchText}')
Here, {searchText} is a placeholder that gets replaced with the value from an input or Clipboard.
If searchText = "max", the resulting filter is:
contains(Name, 'max')
String values should be wrapped in single quotes in OData filters,
for example: City eq 'Berlin' or contains(Name, 'max').
Practical Examples
Text modules in yLabel
A simple text module using event data from a SourceLink:
Hello {firstName} {lastName}, your order number is {orderNumber}.
Connected to a SourceLink event that provides these values, the label will always show the current data.
Table filter from a selection
- A ySelectionPicker provides a country code.
- A yTable uses that value in its filter.
Filter template:
CountryCode eq '{countryCode}'
At runtime:
- user selects
DE - filter string becomes:
CountryCode eq 'DE' - the table loads only entries for Germany.
Best Practices
- Keep template strings readable: prefer
Status eq 'Active'over deeply nested expressions. - Always quote string values with single quotes in OData filters.
- Use clear placeholder names, for example
{customerName}instead of{c}. - For documentation, always show placeholders as inline code:
{value},{customerId},{searchText}.
With template strings and OData operators, you can build dynamic texts and powerful filters without writing full custom code every time.